package com.example.everying.mapper.user;/*
 * 项目名称: everything
 * 文件名: UserMapper
 * 作者: 张泽阳
 * 日期: 2025/5/14
 * 描述:
 */

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.everying.model.dto.user.UserPageDto;
import com.example.everying.model.entity.user.LabelEntity;
import com.example.everying.model.entity.user.UserEntity;
import com.example.everying.model.vo.user.UserInfoVo;
import com.example.everying.model.vo.user.UserPageWithBalance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper extends BaseMapper<UserEntity> {

   public default List<UserEntity> getUserByAdmin(int isAdministrator){
       LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>();
       queryWrapper.eq(UserEntity::getIsAdministrator,isAdministrator);
       queryWrapper.eq(UserEntity::getIsDelete,0);
       return selectList(queryWrapper);
    }

    public Page<UserInfoVo> selectPageWithBalance(@Param("page") Page<UserInfoVo> page, @Param("user") UserPageDto user);

   public void noticeUnreadCountPlus();

   Integer getSignCount(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

   List<String> getNewUserByDate(@Param("date") LocalDate date);


   @Select("SELECT ID FROM information_schema.processlist   WHERE COMMAND = 'Sleep' AND TIME > 300 and User NOT IN ('system user', 'event_scheduler')")
   public List<Map<String, Object>>  test();

   @Select("KILL #{id}")
   public void kill(@Param("id") String id);

    List<String> listAllUserIds();


/*    UserEntity getUserByOpenId(String openId);

    UserEntity getUserById(String id);

    int insertUser(UserEntity user);

    List<UserEntity> selectUserList(UserEntity user);

    int updateUser(UserEntity user);

    int deleteUserById(String id);

    int deleteUserByIds(List<String> ids);*/

}
